import request from '@/utils/request'

import type { UserRoleResponseData, UpdateUserRoleData } from './type'

enum API {
  //根据用户ID获取角色
  GetRoleByUserID_URL = '/admin/acl/user/toAssign/',
  //更新用户角色
  UpdateUserRole_URL = '/admin/acl/user/doAssignRole',
}
//根据用户ID获取角色
export const GetRoleByUserID = (userId: number) =>
  request.get<any, UserRoleResponseData>(API.GetRoleByUserID_URL + userId)
//根据用户ID更新用户角色
export const UpdateUserRole = (data: UpdateUserRoleData) =>
  request.post<any, any>(API.UpdateUserRole_URL, data)
